import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'indexView',
    component: () => import('@/views/index/index'),
    children: [
      {
        path: '/',
        name: 'homeView',
        component: () => import('@/views/homeView/index.vue'),
        children: [
          {
            path: '/',
            name: 'userList',
            alias: '/userList',
            meta: {
              previousMenu: 'system',
              showNav: true,
              title: '人员管理'
            },
            component: () => import('@/views/userList/index.vue'),
          },
          {
            path: '/editPersonnel',
            name: 'editPersonnel',
            meta: {
              previousMenu: 'system',
              showNav: false,
              title: '人员详情'
            },
            component: () => import('@/views/editPersonnel/index.vue'),
          },
          {
            path: '/organizational',
            name: 'organizational',
            meta: {
              previousMenu: 'system',
              showNav: true,
              title: '组织架构'
            },
            component: () => import('@/views/organizational/index.vue'),
          },

        ]
      },
      {
        path: '/404',
        name: 'notFound',
        meta: {
          title: '404',
          showNav: false,
        },
        component: () => import('@/views/notFound/index.vue')
      },
    ]
  },
]
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return VueRouterPush.call(this, location).catch(error => error)
}
const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes,
})


export default router
